'use strict';

const Controller = require('egg').Controller;
const dayjs = require('dayjs');
const _ = require('lodash');

/**
 * @Controller 首页
 */
class MapController extends Controller {
  /**
   * @summary 时间
   * @description 系统时间 日期
   * @Router GET /time
   */
  async carData() {
    const { ctx } = this;
    console.log('carData --> ', dayjs().format('YYYY-MM-DD HH:mm:ss'));
    let times = Number(dayjs().format('ss'));
    ctx.body = {
      code: 200,
      data: {
        times,
        carData: [
          {
            id: 111,
            carName: '测试车111',
            carNum: 'car1',
            carStatus: 'xzz',
            point3d: { x: 106.946943 - 0.001 * 1, y: 27.720225 - 0.001 * 1, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: 'mgreen.png',
            lng: 106.946943 - 0.001 * 1,
            lat: 27.720225 - 0.001 * 1,
            passLnglats: [
              { lng: 106.946943 - 0.002, lat: 27.720225 - 0.0013 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0014 },
              { lng: 106.946943 - 0.0012, lat: 27.720225 - 0.0016 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0051 },
            ],
          },
          {
            id: 222,
            carName: '测试车222',
            carNum: 'car003',
            carStatus: 'yxz',
            point3d: { x: 106.946943 + 0.0001 + 0.000025 * times, y: 27.720225 - 0.0001 + 0.000026 * times, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: 'mblue.png',
            lng: 106.946943 + 0.0001 + 0.000025 * times,
            lat: 27.720225 - 0.0001 + 0.000026 * times,
            passLnglats: [
              { lng: 106.946943 + 0.0001 + 0.000025 * 1, lat: 27.720225 - 0.0001 + 0.000026 * 1 },
              { lng: 106.946943 + 0.0006 + 0.000025 * 15, lat: 27.720225 - 0.0001 + 0.000026 * 15 },
              { lng: 106.946943 + 0.0001 + 0.000025 * 30, lat: 27.720225 - 0.0007 + 0.000026 * 30 },
              { lng: 106.946943 + 0.0005 + 0.000025 * 40, lat: 27.720225 - 0.0001 + 0.000026 * 40 },
              { lng: 106.946943 + 0.0001 + 0.000025 * 60, lat: 27.720225 - 0.0001 + 0.000026 * 60 },
            ],
          },
          {
            id: 333,
            carName: '测试车333',
            carNum: 'car999',
            carStatus: 'yxz',
            point3d: { x: 106.946943 - 0.0005 - 0.000022 * times, y: 27.720225 + 0.00002 * times, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: 'mblue.png',
            lng: 106.946943 - 0.0005 - 0.000022 * times,
            lat: 27.720225 + 0.00002 * times,
            passLnglats: [
              { lng: 106.946943 - 0.0005 - 0.000022 * 1, lat: 27.720225 + 0.00002 * 1 },
              { lng: 106.946943 - 0.00035 - 0.000022 * 15, lat: 27.720225 + 0.00002 * 15 },
              { lng: 106.946943 - 0.00056 - 0.000022 * 30, lat: 27.720225 + 0.00002 * 30 },
              { lng: 106.946943 - 0.0005 - 0.000022 * 40, lat: 27.720225 + 0.00002 * 40 },
              { lng: 106.946943 - 0.0005 - 0.000022 * 60, lat: 27.720225 + 0.00002 * 60 },
            ],
          },
          {
            id: 444,
            carName: '测试车44',
            carNum: 'car202104280203',
            carStatus: times > 40 ? 'gz' : 'yxz',
            point3d: { x: 106.946943 - 0.0008 + 0.000015 * times, y: 27.720225 - 0.0005 - 0.000015 * times, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: times > 40 ? 'mred.png' : 'mblue.png',
            lng: 106.946943 - 0.0008 + 0.000015 * times,
            lat: 27.720225 - 0.0005 - 0.000015 * times,
            passLnglats: [
              { lng: 106.946943 - 0.0008 + 0.000015 * 1, lat: 27.720225 - 0.0005 - 0.000015 * 1 },
              { lng: 106.946943 - 0.0008 + 0.000015 * 15, lat: 27.720225 - 0.000015 * 15 },
              { lng: 106.946943 + 0.000015 * 26, lat: 27.720225 - 0.0005 - 0.000015 * 26 },
              { lng: 106.946943 - 0.0008 + 0.000015 * 30, lat: 27.720225 - 0.0008 - 0.000015 * 30 },
              { lng: 106.946943 - 0.0008 + 0.000015 * 60, lat: 27.720225 - 0.0005 - 0.000015 * 60 },
            ],
          },
          {
            id: 555,
            carName: '测试车55',
            carNum: 'car202104280216',
            carStatus: 'wx',
            point3d: { x: 106.946943 - 0.0029, y: 27.720225 - 0.0025, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: 'mgree.png',
            lng: 106.946943 - 0.0029,
            lat: 27.720225 - 0.0025,
            passLnglats: [
              { lng: 106.946943 - 0.002, lat: 27.720225 - 0.0013 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0014 },
              { lng: 106.946943 - 0.0012, lat: 27.720225 - 0.0016 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0051 },
            ],
          },
          {
            id: 666,
            carName: '测试车66',
            carNum: 'car202104290273',
            carStatus: times > 50 ? 'xzz' : 'cdz',
            point3d: { x: 106.946943 - 0.0026, y: 27.720225 - 0.00162, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: times > 50 ? 'mgreen.png' : 'morgane.png',
            lng: 106.946943 - 0.0026,
            lat: 27.720225 - 0.00162,
            passLnglats: [
              { lng: 106.946943 - 0.002, lat: 27.720225 - 0.0013 },
              { lng: 106.946943 - 0.0026, lat: 27.720225 - 0.00162 },
              { lng: 106.946943 - 0.0012, lat: 27.720225 - 0.0016 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0051 },
            ],
          },
          {
            id: 777,
            carName: '测试车77',
            carNum: 'car202105140306',
            carStatus: 'gz',
            point3d: { x: 106.946943 - 0.0022, y: 27.720225 - 0.00152, z: 0 },
            point3dList: [],
            currentTask: {},
            icon: 'mred.png',
            lng: 106.946943 - 0.0022,
            lat: 27.720225 - 0.00152,
            passLnglats: [
              { lng: 106.946943 - 0.002, lat: 27.720225 - 0.0013 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0014 },
              { lng: 106.946943 - 0.0012, lat: 27.720225 - 0.0016 },
              { lng: 106.946943 - 0.001, lat: 27.720225 - 0.0051 },
            ],
          },
        ],
      },
      msg: '车辆地图数据',
    };
  }
}

module.exports = MapController;
